<?php

class Action {

    protected $class;
    protected $method;
    protected $object;
    protected $args = array();
    protected $need_post_processing = false;

    //protected $path_mask;

    public function __construct($route, $args = array()) {
        $parts = explode('::', $route);
        $this->class = $parts[0];
        $this->method = (empty($parts[1]) ? "index" : $parts[1]);
        $this->args = $args;
        $this->need_post_processing = ($_SERVER['REQUEST_METHOD'] == 'POST'? true: false);
        //$this->object = new $this->class();
        if (!empty($parts[2]))
            $this->args = array_merge(explode(',', $parts[2]), $this->args);
//        $this->path_mask = $this->method;
//        for ($i = 0; $i < count($this->args); $i++) {
//            if (is_numeric($args[$i]))
//                $this->path_mask.='/%num%';
//            else
//                $this->path_mask.='/%text%';
//        }
    }
//
//    public function getObject() {
//        return $this->object;
//    }

    public function resetNeedPostProcessing() {
        $this->need_post_processing = false;
    }
    public function isNeedPostProcessing() {
        return $this->need_post_processing;
    }
    
    public function getClass() {
        return $this->class;
    }

    public function getMethod() {
        return $this->method;
    }
    public function setArgs($args) {
        $this->args = $args;
    }
    public function getArgs() {
        return $this->args;
    }
//    public function getPathMask()
//    {
//        return $this->path_mask;
//    }

}

?>